<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('Category/index')}">所有分类</a></li>
        <li><a href="{:url('Category/add')}">添加分类</a></li>
    </ul>
    <form method="post" class="js-ajax-form margin-top-20" action="{:url('Category/listOrder')}">
            <div class="table-actions">
                <button class="btn btn-primary btn-sm js-ajax-submit" type="submit">{:lang('SORT')}</button>
                <button class="btn btn-sm btn-success js-ajax-submit" type="submit"
                        data-action="{:url('Category/toggle',array('status'=>1))}" data-subcheck="true">{:lang('DISPLAY')}
                </button>
                <button class="btn btn-sm btn-danger js-ajax-submit" type="submit"
                        data-action="{:url('Category/toggle',array('status'=>2))}" data-subcheck="true">{:lang('HIDDEN')}
                </button>
            </div>
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th width="16"><label><input type="checkbox" class="js-check-all" data-direction="x"
                                             data-checklist="js-check-x"></label></th>
                <th width="50">{:lang('SORT')}</th>
                <th width="40">ID</th>
                <th>分类名称</th>
                <th>类别</th>
                <th>描述</th>
                <th>{:lang('STATUS')}</th>
                <th width="160">{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <php>$status=array("1"=>lang('DISPLAY'),"2"=>lang('HIDDEN'));</php>
            <foreach name="list" item="vo">
                <tr>
                    <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo.cate_id}"></td>
                    <td>
                        <input name="list_orders[{$vo.cate_id}]" class="input-order" type="text" value="{$vo.list_order}">
                    </td>
                    <td>{$vo.cate_id}</td>
                    <td>{$vo.cate_name}</td>
                    <td><if condition="$vo['type'] eq 1">精品课程<else/>试听课</if></td>
                    <td>{$vo.desc}</td>
                    <td>
                        <if condition="$vo.status eq 2">
                            <span class="label btn-danger">
                                {$status[$vo['status']]}
                            </span>
                            <else/>
                            <span class="label label-success">
                                {$status[$vo['status']]}
                            </span>
                        </if>
                    </td>
                    <td>
                        <a class="btn btn-xs btn-success"  href="{:url('Category/edit',array('cate_id'=>$vo['cate_id']))}">{:lang('EDIT')}</a>
                        <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('Category/delete',array('cate_id'=>$vo['cate_id']))}">{:lang('DELETE')}</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <div class="pagination">{$page}</div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>